<template>
	<view class="">
		<navigator :url="'/pages/goods_detail/goods_detail?id='+item.id" class="goodslist" v-for="(item,index) in list" :key="index">
			<view class="goodslist-item">
				<view class="goodslist-item-pic"><image :src="item.image" mode=""></image></view>
				<view class="goodslist-item-content">
					<view class="content-view">
						<view class="text">{{item.store_name}}</view>
						<view class="money">
							￥
							<text class="num">{{item.price}}</text>
						</view>
						<view class="vip-money">
							￥{{item.vip_price}}
							<image src="../../static/images/vip.png" mode=""></image>
							<text class="num">已售{{item.sales}}</text>
						</view>
					</view>
				</view>
				<view class="goodslist-icon iconfont icon-gouwuche"></view>
			</view>
		</navigator>
	</view>
</template>

<script>
	import api from "@/api/api.js";
	export default{
		props:{
			list:{
				type:Array,
				default:function(){
					return [];
				}
			}
		},
		methods:{
			addCart:function(id){
				let data = {};
				data.productId = id;
				data.cartNum = 1;
				data.new = 1;
				api.cart.addCart(data).then(e=>{
					console.log(e)
				})
			}
		}
	}
</script>

<style scoped>
	.goodslist{
		
	}
	.goodslist-item{
		position: relative;
		padding-left: 30rpx;
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
	}
	.goodslist-item-pic{
		width: 180rpx;
		height: 180rpx;
		position: relative;
	}
	.goodslist-item-pic image{
		border-radius: 6rpx;
	}
	.goodslist-item-content{
		padding: 30rpx 30rpx 30rpx 0;
		border-bottom: 1px solid #f5f5f5;
	}
	.content-view{
		font-size: 30rpx;
		color: #222;
		width: 489rpx;
	}
	.text{
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.money{
		font-size: 26rpx;
		font-weight: bold;
		margin-top: 50rpx;
		color: #fc4141!important;
	}
	.money .num{
		font-size: 34rpx;
	}
	.vip-money{
		font-size: 24rpx;
		color: #282828;
		font-weight: bold;
		margin-top: 15rpx;
		align-items: center;
		display: flex;
		flex-wrap: wrap;
	}
	.vip-money image{
		width: 46rpx;
		height: 21rpx;
		margin-left: 5rpx;
		display: inline-block;
		overflow: hidden;
	}
	.vip-money .num{
		font-size: 22rpx;
		color: #aaa;
		font-weight: normal;
		margin: -2rpx 0 0 22rpx;
	}
	.goodslist-icon{
		position: absolute;
		right: 30rpx;
		width: 50rpx;
		height: 50rpx;
		border-radius: 50%;
		font-size: 30rpx;
		bottom: 38rpx;
		align-items: center;
		justify-content: center;
		color: #ff3700!important;
		border: 1px solid #ff3700!important;
		display: flex;
		flex-wrap: wrap;
	}
</style>
